﻿{layout:default} {class:Shop.Admin.agent.product}
<lbhead>
    <title><%=Tag("商品列表")%>-<%=site.title%></title>
</lbhead>
<lbpath>
    <div class="tools">
    <ul>
    <li class="add"><a href="javascript:void(0);" onclick="Product_Add()"><b></b><span><%=Tag("添加")%></span></a></li>
    <li class="del"><a href="javascript:void(0);" onclick="Product_Del();"><b></b><span><%=Tag("删除")%></span></a></li>
    <li class="name"><span id="navIgation"><%=Tag("当前位置")%>：<a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a> > <a href="<%=site.AdminPath %>/product/"><%=Tag("商品列表")%></a></span></li>
    </ul>
    </div>
</lbpath>
<lbbody>
    <link rel="stylesheet" type="text/css" href="<%=site.AdminJsPath %>/prettyphoto/css/prettyPhoto.css" />
    <script language="javascript" type="text/javascript" src="<%=site.AdminJsPath %>/prettyphoto/jquery.prettyphoto.js"></script>
    <div class="searchbox">
        
        <select name="status" id="status">
            <option value="0">┌<%=Tag("状态")%></option>
            <option value="1" <%=status==1?"selected":"" %>><%=Tag("已代理")%></option>
            <option value="2" <%=status==2?"selected":"" %>><%=Tag("未代理")%></option>
        </select>
        <input type="text" id="key" name="key" class="input-query" value="<%=key %>" onkeydown="if(event.keyCode==13){search_();}" /><input type="button" id="btnSou" class="btn-query" onclick="search_();" />
    </div>
    <table id="list" class="datalist">
        <tr class="title">
            <th style="width: 40px" class="selectAll">
                <a href="javascript:void(0);" onclick="$('input[name=\'sonproductid\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
            </th>
            <th style="width: 40px">
                <%=Tag("图片")%>
            </th>
            <th style="width: 80px">
                <%=Tag("编号")%>
            </th>
            <th style="width: 340px">
                <%=Tag("商品名称")%>
            </th>
            <th style="width: 60px">
                <%=Tag("子商品")%>
            </th>
            <th style="width: 80px">
                <%=Tag("销售价")%>
            </th>
            <th style="width: 60px">
                <%=Tag("库存")%>
            </th>
            <th style="width: 60px">
                <%=Tag("冻结库存")%>
            </th>
            <th style="width: 60px">
                <%=Tag("销量")%>
            </th>
            <th style="width: 60px">
                <%=Tag("浏览量")%>
            </th>
            <th style="width: 60px">
                <%=Tag("状态")%>
            </th>
            <th style="width: 120px">
                <%=Tag("代理人")%>
            </th>
            <th style="width: 60px">
                <%=Tag("佣金")%>
            </th>
        </tr>
        <%foreach (Shop.Model.Lebi_Agent_Product amodel in models)
          {
              Shop.Model.Lebi_Product model = Shop.Bussiness.EX_Product.GetProduct(amodel.Product_id);
              Shop.Model.Lebi_Agent_Product_User auser = GetAgentUser(amodel.User_id);
          %>
        <script type="text/javascript">
            $(document).ready(function () {
                $("area[rel^='prettyPhoto<%=model.id %>']").prettyPhoto();
                $(".piclist<%=model.id %>:first a[rel^='prettyPhoto<%=model.id %>']").prettyPhoto({ animation_speed: 'fast', slideshow: 10000, hideflash: true });
            })
        </script>
            <tr class="list">
                <td style="text-align:center">
                    <input type="checkbox" ShopKeyID="true" name="productid" id="<%=model.id %>" value="<%=model.id %>" />
                </td>
                <td>
                    <div class="piclist<%=model.id %>">
                    <a href="<%=site.WebPath + model.ImageOriginal %>" rel="prettyPhoto<%=model.id %>[]" target="_blank"><img style="height: 30px;width: 30px;vertical-align:middle" src="<%=site.WebPath + model.ImageSmall %>" /></a>
                    </div>
                </td>
                <td>
                    <%=model.Number%>
                </td>
                <td><%=Lang(model.Name)%>&nbsp;<a target="_blank" href="<%=Shop.Bussiness.ThemeUrl.GetURL("P_Product",model.id.ToString(),"",CurrentLanguage.Code)%>"><img src="<%=PageImage("icon/newWindow.png")%>" /></a>
                
                </td>
                <td>
                    <a href="subproduct_edit.aspx?id=<%=model.id %>" title="<%=Tag("编辑")%>"><%=CountSon(model.id)%></a>
                </td>
                <td>
                    
                    <%=FormatMoney(model.Price)%>
           
                </td>
     
                <td>
                    <%=model.Count_Stock%>
                </td>
                <td>
                    <a href="javascript:void(0)" onclick="Product_Freeze('<%=model.Number %>');" title="<%=Tag("查看")%>"><%=model.Count_Freeze%></a>
                </td>
                <td>
                    <a href="javascript:void(0)" onclick="Product_Sales('<%=model.Number %>');" title="<%=Tag("查看")%>"><%=model.Count_Sales_Show %></a>
                </td>
                <td>
                    <%=model.Count_Views_Show%>
                </td>
                <td>
                    <span id="ProductStatus<%=model.id %>">
                        <%=Shop.Bussiness.EX_Type.TypeName(model.Type_id_ProductStatus)%>
                    </span><input type="hidden" id="Type_id_ProductStatus<%=model.id %>" value="<%=model.Type_id_ProductStatus %>" />
                </td>
               <td>
                    <%=amodel.User_UserName%>
                </td>
                <td>
                    <%=auser.Commission%>%
                </td>
            </tr>
        <%} %>
    </table>
    <script type="text/javascript">
        function search_(scurl) {
            var key = $("#key").val();
            var status=$("#status").val();
            window.location = "?key=" + escape(key)+"&status="+status;
        }
        
        function Product_Del() {
            if (!confirm("<%=Tag("确认要删除吗？")%>"))
                return false;
            var postData = GetFormJsonData("ShopKeyID");
            var url = "<%=site.AdminPath %>/ajax/ajax_agent.aspx?__Action=Product_Del";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
       function Product_Add(para)
       {
            var title_ = "<%=Tag("商品添加")%>"; 
            var url_ = "product_add_window.aspx?t=add&"+para;
            var width_ = 400;
            var height_ = 250;
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
       }
    </script>
</lbbody>
<lbbottom>
<div class="bottom" id="body_bottom">
    <%=PageString%>
</div>
</lbbottom>